﻿#region [===== Using =====]
using System;
using Microsoft.SharePoint;
#endregion

namespace TPG.SharePoint.Workflow
{
    /// <summary>
    /// A control for handling tasks created during workflow execution 
    /// which can be hosted inside a page using the hosted control framework.
    /// </summary>
    public abstract class TaskControl
        : WorkflowDataControl<TaskData, TaskMetaData>
    {
        /// <summary>
        /// Gets the <see cref="SPListItem" /> object that
        /// represents the list item that the workflow 
        /// is running on.
        /// </summary>
        public SPListItem WorkflowItem
        {
            get { return MetaData.WorkflowItem; }
        }

        /// <summary>
        /// Gets the date that the task is due.
        /// </summary>
        public DateTime? DueDate
        {
            get { return MetaData.DueDate; }
        }

        /// <summary>
        /// Gets the date that the task starts.
        /// </summary>
        public DateTime? StartDate
        {
            get { return MetaData.StartDate; }
        }

        /// <summary>
        /// Gets the priority of the task.
        /// </summary>
        public string Priority
        {
            get { return MetaData.Priority; }
        }

        /// <summary>
        /// Gets a value indicating how much of the task has been completed.
        /// </summary>
        public double? PercentageComplete
        {
            get { return MetaData.PercentageComplete; }
        }

        /// <summary>
        /// Gets the person or group that the task is assigned to.
        /// </summary>
        public SPFieldUserValue AssignedTo
        {
            get { return MetaData.AssignedTo; }
        }

        /// <summary>
        /// Gets a HTML RichText value describing the task.
        /// </summary>
        public string Body
        {
            get { return MetaData.Body; }
        }
    }
}
